import http from '@/components/common/tui-request'

//获取检验批列表
export const getProjectLotList = (projectId,page,limit) => {
	return http.request({
		url: `/project-lot/getProjectLotList/${projectId}/${page}/${limit}`,
		method: 'GET',
	});
};

//根据id获取检验批信息
export const selectProjectLotById = (projectLotId) => {
	return http.request({
		url: `/project-lot/selectProjectLotById?projectLotId=${projectLotId}`,
		method: 'GET',
	});
};

//根据id获取检验批id
export const getProjectLotInfoById = (projectLotId) => {
	return http.request({
		url: `/project-lot/getProjectLotInfoById?projectLotId=${projectLotId}`,
		method: 'GET',
	});
};

//上传检验批附件
export const uploadProjectLotAttach = (file) => {
	return uni.uploadFile({
		url: 'http://192.168.1.127:8086/project-lot/uploadProjectLotAttach',
		filePath: file.objectUrl,
		name: 'files',
		header: {'Authorization': uni.getStorageSync('token')}
	});
};

//删除检验批附件
export const deleteProjectLotFile = (fileId) => {
	return http.request({
		url: `/project-lot-file/deleteProjectLotFile/${fileId}`,
		method: 'DELETE',
	});
};

//批量删除检验批附件
export const deleteProjectLotFile2 = (fileIds) => {
	return http.request({
		url: `/project-lot-file/deleteProjectLotFile?fileIds=${fileIds}`,
		method: 'DELETE',
	});
};

//获取单位工程下拉列表
export const getProjectUnitProjectManageList = (projectId) => {
	return http.request({
		url: `/project-unit-project/getProjectUnitProjectManageList/${projectId}`,
		method: 'GET',
	});
};

//获取分部分项下拉列表
export const getSysSubsectionManageList = () => {
	return http.request({
		url: `/sys-subsection/getSysSubsectionManageList`,
		method: 'GET',
	});
};

//新增检验批
export const addProjectLot = (projectId,data) => {
	return http.request({
		url: `/project-lot/addProjectLot/${projectId}`,
		data:data,
		method: 'POST',
	});
};

//提交送审
export const startProjectLotProcess = (projectLotId) => {
	return http.request({
		url: `/project-lot/startProjectLotProcess?projectLotId=${projectLotId}`,
		method: 'POST',
	});
};

//确认审批
export const completeProjectLotTask = (data) => {
	return http.request({
		url: `/project-lot/completeProjectLotTask`,
		data:data,
		method: 'POST',
	});
};

//删除检验批
export const deleteUnSubProjectLot = (projectLotId) => {
	return http.request({
		url: `/project-lot/deleteUnSubProjectLot/${projectLotId}`,
		method: 'DELETE',
	});
};

//获取检验批已办数据
export const getDoneTask = (projectId) => {
	return http.request({
		url: `/project-lot/getDoneTask/${projectId}`,
		method: 'GET',
	});
};

//获取检验批待办数据
export const getTodoTask = (projectId,page,limit) => {
	return http.request({
		url: `/project-lot/getTodoTask/${projectId}/${page}/${limit}`,
		method: 'GET',
	});
};

//获取用户待办及已办数据
export const getTask = (projectId) => {
	return http.request({
		url: `/project-lot/getTask/${projectId}`,
		method: 'GET',
	});
};

//重新送审
export const reStartProjectLotProcess = (projectLotId) => {
	return http.request({
		url: `/project-lot/reStartProjectLotProcess?projectLotId=${projectLotId}`,
		method: 'POST',
	});
};

//获取检验批所有数据
export const getFullProjectLotInfoById = (projectLotId) => {
	return http.request({
		url: `/project-lot/getFullProjectLotInfoById?projectLotId=${projectLotId}`,
		method: 'GET',
	});
};

//修改检验批
export const updateProjectLotProcess = (data) => {
	return http.request({
		url: `/project-lot/updateProjectLotProcess`,
		method: 'PUT',
		data:data
	});
};